/*******************************************************************************
 * Copyright (c) 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 ******************************************************************************/

package org.reliablesource.pleiades;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import org.reliablesource.model.core.ReliableNode;

/**
 * @since 3.2
 * 
 */
public class ReliableUser extends ReliableNode {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private final List<ReliableSimpleComment> createdComments;

	public ReliableUser() {
		super();
		createdComments = new LinkedList<ReliableSimpleComment>();
	}

	public ReliableSimpleComment[] getCreatedComments() {
		return createdComments
				.toArray(new ReliableSimpleComment[createdComments.size()]);
	}

	public List<ReliableSimpleComment> getCreatedCommentsList() {
		List _list = new ArrayList();
		_list.addAll(createdComments);
		return _list;
	}

	public boolean addComment(ReliableSimpleComment _comment) {
		if (!createdComments.contains(_comment))
			return createdComments.add(_comment);
		return false;
	}

	public boolean removeComment(ReliableSimpleComment _comment) {
		if (createdComments.contains(_comment))
			return createdComments.remove(_comment);
		return false;
	}
}
